1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.ClampLayout; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import glib.ConstructionException; 30 private import gobject.ObjectG; 31 private import gtk.LayoutManager; 32 private import gtk.OrientableIF; 33 private import gtk.OrientableT; 34 35 36 /** 37 * A layout manager constraining its children to a given size. 38 * 39 * <picture> 40 * <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)"> 41 * <img src="clamp-wide.png" alt="clamp-wide"> 42 * </picture> 43 * <picture> 44 * <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)"> 45 * <img src="clamp-narrow.png" alt="clamp-narrow"> 46 * </picture> 47 * 48 * `AdwClampLayout` constraints the size of the widgets it contains to a given 49 * maximum size. It will constrain the width if it is horizontal, or the height 50 * if it is vertical. The expansion of the children from their minimum to their 51 * maximum size is eased out for a smooth transition. 52 * 53 * If a child requires more than the requested maximum size, it will be 54 * allocated the minimum size it can fit in instead. 55 * 56 * Each child will get the style classes .large when it reached its maximum 57 * size, .small when it's allocated the full size, .medium in-between, or none 58 * if it hasn't been allocated yet. 59 * 60 * Since: 1.0 61 */ 62 public class ClampLayout : LayoutManager, OrientableIF 63 { 64 /** the main Gtk struct */ 65 protected AdwClampLayout* adwClampLayout; 66 67 /** Get the main Gtk struct */ 68 public AdwClampLayout* getClampLayoutStruct(bool transferOwnership = false) 69 { 70 if (transferOwnership) 71 ownedRef = false; 72 return adwClampLayout; 73 } 74 75 /** the main Gtk struct as a void* */ 76 protected override void* getStruct() 77 { 78 return cast(void*)adwClampLayout; 79 } 80 81 /** 82 * Sets our main struct and passes it to the parent class. 83 */ 84 public this (AdwClampLayout* adwClampLayout, bool ownedRef = false) 85 { 86 this.adwClampLayout = adwClampLayout; 87 super(cast(GtkLayoutManager*)adwClampLayout, ownedRef); 88 } 89 90 // add the Orientable capabilities 91 mixin OrientableT!(AdwClampLayout); 92 93 94 /** */ 95 public static GType getType() 96 { 97 return adw_clamp_layout_get_type(); 98 } 99 100 /** 101 * Creates a new `AdwClampLayout`. 102 * 103 * Returns: the newly created `AdwClampLayout` 104 * 105 * Since: 1.0 106 * 107 * Throws: ConstructionException GTK+ fails to create the object. 108 */ 109 public this() 110 { 111 auto __p = adw_clamp_layout_new(); 112 113 if(__p is null) 114 { 115 throw new ConstructionException("null returned by new"); 116 } 117 118 this(cast(AdwClampLayout*) __p, true); 119 } 120 121 /** 122 * Gets the maximum size allocated to the children. 123 * 124 * Returns: the maximum size to allocate to the children 125 * 126 * Since: 1.0 127 */ 128 public int getMaximumSize() 129 { 130 return adw_clamp_layout_get_maximum_size(adwClampLayout); 131 } 132 133 /** 134 * Gets the size above which the children are clamped. 135 * 136 * Returns: the size above which the children are clamped 137 * 138 * Since: 1.0 139 */ 140 public int getTighteningThreshold() 141 { 142 return adw_clamp_layout_get_tightening_threshold(adwClampLayout); 143 } 144 145 /** 146 * Sets the maximum size allocated to the children. 147 * 148 * Params: 149 * maximumSize = the maximum size 150 * 151 * Since: 1.0 152 */ 153 public void setMaximumSize(int maximumSize) 154 { 155 adw_clamp_layout_set_maximum_size(adwClampLayout, maximumSize); 156 } 157 158 /** 159 * Sets the size above which the children are clamped. 160 * 161 * Params: 162 * tighteningThreshold = the tightening threshold 163 * 164 * Since: 1.0 165 */ 166 public void setTighteningThreshold(int tighteningThreshold) 167 { 168 adw_clamp_layout_set_tightening_threshold(adwClampLayout, tighteningThreshold); 169 } 170 }